<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$CONF['mallTitle']}后台管理中心</title>
    <link href="Public/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/jquery-ui/css/base/jquery-ui-1.10.4.custom.min.css" />
    <!--[if lt IE 9]>
    <script src="Public/js/html5shiv.min.js"></script>
    <script src="Public/js/respond.min.js"></script>
    <![endif]-->
    <script src="Public/js/jquery.min.js"></script>
    <script src="Public/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="Public/js/common.js"></script>
    <script src="Public/plugins/plugins/plugins.js"></script>
    <script src="__PUBLIC__/jquery-ui/jquery-ui-1.10.4.custom.min.js"></script>
    <script src="__PUBLIC__/js/common.js"></script>
    <style>
        .control-box{
            position: absolute;
            right: 15px;
            top: 5px;
        }

        .control-box a{
            margin-left: 10px;
        }

        #goodsSelected>span{
            margin:5px 10px;
        }

        #shopsSelected>span{
            margin:5px 10px;
        }

        #tGoodsList li{
            border-bottom: solid 1px grey;
        }

        #tGoodsList img{
            width:100px;
            height:100px;
        }

        .imgPreview img{
            width:50px;
            height:50px;
        }

        #shopsSelected,#goodsSelected {
            min-height: 50px;
        }


         .panel{
             border-radius: 0px;

         }

        .panel-heading{
            border-radius: 0px;
        }


        .wst-tab-box{width:100%; height:auto; margin:0px auto;}
        .wst-tab-nav{margin:0; padding:0; height:25px; line-height:24px;position: relative;top:2px;left:3px;}
        .wst-tab-nav li{cursor:pointer;float:left; margin:0 0px; list-style:none; border:1px solid #ddd; border-bottom:none; height:24px; width:100px; text-align:center; background:#eeeeee;color:#000000;}
        .wst-tab-nav .on{background:#ffffff;color:#000000;border-bottom:0 none;}
        .wst-tab-content{padding:5px;width:99%; height:auto; border:1px solid #ddd;background:#FFF;}
        .wst-gallery-imgs{width:770px;height:auto;}
        .wst-gallery-img{width:140px;height:100px;float:left;overflow:hidden;margin:10px 5px 5px 5px;}

    </style>


</head>
<body>


<div class="panel panel-default" id="selectShopBox" currentStep="1">
    <div class="panel-heading">
        <h3 class="panel-title">
            选择商家
        </h3>
        <div class="pull-right control-box">
            <a class="btn btn-default last-step hidden">上一步</a>
            <a class="btn btn-default next-step">下一步</a>
        </div>
    </div>
    <div class="panel-body">
        <div class="panel panel-default">
            <div class="panel-heading">

                已选商家

            </div>
            <div class="panel-body" id="shopsSelected">

            </div>
        </div>
        <form  id="searchShopForm">
            <div class='wst-tbar'>
                地区：<select id='areaId1' name='areaId1' onchange='javascript:getAreaList("areaId2",this.value,0)'>
                <option value=''>请选择</option>
                <volist name="areaList" id="vo">
                    <option value='{$vo["areaId"]}' <if condition="$areaId1 == $vo['areaId'] ">selected</if>>{$vo['areaName']}</option>
                </volist>
            </select>
                <select id='areaId2' name='areaId2'>
                    <option value=''>请选择</option>
                </select>
                商家名称：<input type='text' id='shopName' name='shopName' class='form-control wst-ipt-10' value='{$shopName}'/>
                商家编号：<input type='text' id='shopSn' name='shopSn' class='form-control wst-ipt-10' value='{$shopSn}'/>
                <button type="button" class="btn btn-primary glyphicon glyphicon-search" id="searchShopBtn">查询</button>
            </div>
        </form>
        <div class='wst-body'>
            <div>
                商家列表
            </div>
            <table class="table table-hover table-striped table-bordered wst-list">
                <thead>
                <tr>
                    <th width='80'>商家名称</th>
                    <th width='80'>商家编号</th>
                    <th width='80'>店主</th>
                    <th width='80'>分类</th>
                    <th width='20' class="text-center">操作</th>
                </tr>
                </thead>
                <tbody  id="shopsListBody">
                <volist name="Page['root']" id="vo" >
                    <tr>
                        <td style="display:none;">{$vo['shopId']}</td>
                        <td>{$vo['shopName']}</td>
                        <td>{$vo['shopSn']}&nbsp;</td>
                        <td>{$vo['userName']}&nbsp;</td>
                        <td>{$vo['catName']}&nbsp;</td>
                        <td class="text-center"><a class="btn btn-primary glyphicon selectShops" >选择</a></td>
                    </tr>
                </volist>
                <tr>
                    <td colspan='11' align='center'>{$Page['pager']}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="panel panel-default hidden" id="selectGoodsBox" currentStep="2">
    <div class="panel-heading">
        <h3 class="panel-title">
            选择商品
        </h3>

        <div class="pull-right control-box">
            <a class="btn btn-default last-step">上一步</a>
            <a class="btn btn-default next-step">下一步</a>
        </div>

    </div>
    <div class="panel-body">
        <div class="panel panel-default">
            <div class="panel-heading">

                    已选商品

            </div>
            <div class="panel-body" id="goodsSelected">

            </div>
        </div>
        <form method='post' action='{:U("Admin/Goods/index")}' autocomplete="off">
            <div class='wst-tbar'>

                <!--<select id='goodsCatId2' name='goodsCatId2' onchange='javascript:getCatList("goodsCatId3",this.value,1);'>-->
                <!--<option value='0'>请选择</option>-->
                <!--</select>-->
                <!--<select id='goodsCatId3' name='goodsCatId3'>-->
                <!--<option value='0'>请选择</option>-->
                <!--</select>-->
            </div>
            <div class='wst-tbar'>
                所属商家：<select name="goodsShopName" id="goodsShopName">

                            </select>
                商品：<input type='text' id='goodsName' name='goodsName' />
                <button id="searchGoodsBtn" type="button" class="btn btn-primary glyphicon glyphicon-search">查询</button>
            </div>
        </form>
        <div class='wst-body'>

            <table class="table table-hover table-striped table-bordered wst-list">
                <thead>
                <tr>



                    <th width='180'>商品名称</th>
                    <th width='60'>商品编号</th>
                    <th width='80'>价格</th>
                    <th width='100'>商家</th>
                    <th width='100'>商城分类</th>
                    <th width='40' class="text-center">操作</th>

                </tr>
                </thead>
                <tbody id="goodsListBody">

                <!--<tr>-->
                    <!--<td colspan='10' align='center'>{$Page['pager']}</td>-->
                <!--</tr>-->
                </tbody>
            </table>
        </div>
    </div>
</div>


<div class="panel panel-default hidden" id="packagePriceBox" currentStep="3">
    <div class="panel-heading">
        <h3 class="panel-title">
            套餐内容
        </h3>
        <div class="pull-right control-box">
            <a class="btn btn-default last-step">上一步</a>
            <a class="btn btn-default next-step">完成</a>
        </div>
    </div>
    <div class="panel-body">
        <div class="panel panel-default">
            <div class="panel-headding">
                <strong>套餐商品列表</strong>
            </div>
            <div class="panel-body">
                <ul class="media-list" id="tGoodsList">

                </ul>
            </div>
        </div>


        <div>
            <div class="panel panel-default">
                <div class="panel-headding">
                    <strong>套餐属性</strong>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        套餐名称：<input name="tName" id="tName">
                    </div>
                    <div class="form-group">套餐时间：<input id="tStartTime">-<input id="tEndTime"></div>
                    <div class="form-group">套餐简介：
             <textarea id="tDesc" style="width: 100%;height: 200px;">

            </textarea>
                    </div>
                </div>
            </div>



        </div>
    </div>
</div>




<!-- 模态框（Modal） -->
<div class="modal fade text-center" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="display: inline-block; width: auto;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="priceSelect">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>


<!--警告框-->

<div class="modal fade text-center" id="alertModal">
    <div class="modal-dialog " style="display:inline-block;width:300px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">警告</h4>
            </div>
            <div class="modal-body">
                <p></p>
            </div>
            <div class="modal-footer">
                <a class="btn btn-success" data-dismiss="modal">确定</a>
            </div>
        </div>
    </div>
</div>
    

</body>

<script>

    var shopsSelectedList = new Object();
    var goodsSelectedList = new Object();
    var periodSelected = new Object();
    $("#tStartTime").datepicker({
        showButtonPanel:false,
        monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        dateFormat: 'yy-mm-dd'

    });

    $("#tEndTime").datepicker({
        showButtonPanel:false,
        monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        dateFormat: 'yy-mm-dd'

    });

   /**
    * 根据数字转成
    *
    * **/

    function numberToWeek(number){
       var weekDate = '';
       switch(number){
           case 1:
               weekDate = "星期一";
               break;
           case 2:
               weekDate = "星期二";
               break;
           case 3:
               weekDate = "星期三";
               break;
           case 4:
               weekDate = "星期四";
               break;
           case 5:
               weekDate = "星期五";
               break;
           case 6:
               weekDate = "星期六";
               break;
           case 7:
               weekDate = "星期日";
               break;

       }

       return weekDate;
    }



    // 弹出提示框
    function alertModal(content){
        $("#alertModal p").text(content);
        $("#alertModal").modal();
    }



    function getGoodsListAjax(p,callback){
        var p = arguments[0] ? arguments[0] : 1;
        $.get("{:U('Admin/Package/getGoodsListByShopId')}",
                {
                    "shopId":$("#goodsShopName").val(),
                    "goodsName":$("#goodsName").val(),
                    "p":p
                },
                function(data){
                    var trStr = '';
                    var goodsList = data.data;
                    $("#goodsListBody").empty();
                    for(var i = 0;i < goodsList.length;i++){
                        var goodsTrObj = document.createElement("tr");
                        $(goodsTrObj).append("<td style='display: none;'>"+goodsList[i].goodsId+"</td>");
                        $(goodsTrObj).append(" <td img='"+goodsList[i].goodsThums+"' class='imgPreview'> <img src='__ROOT__/"+goodsList[i].goodsThums+"' width='50'/>"+goodsList[i].goodsName+" </td>");
                        $(goodsTrObj).append("  <td>"+goodsList[i].goodsSn+"&nbsp;</td>");
                        var priceStr = '';
                        var controlStr = '';
                        if(parseFloat(goodsList[i].shopPrice) > 0){
                            priceStr = goodsList[i].shopPrice;
                            controlStr = '<td class="text-center"><a class="btn btn-primary glyphicon selectGoods" >选择</a></td>'
                        }else{
                            priceStr = "未选择";
                            controlStr = '<td class="text-center"><a class="btn btn-primary glyphicon selectPeriod" style="margin-right:5px;" >时段</a><a class="btn btn-primary glyphicon selectGoods" >选择</a></td>'

                        }
                        $(goodsTrObj).append("<td>"+priceStr+"&nbsp;</td>");
                        $(goodsTrObj).append("<td>"+goodsList[i].shopName+"&nbsp;</td>");
                        $(goodsTrObj).append("<td>"+goodsList[i].catName+"&nbsp;</td>");
                        $(goodsTrObj).append("<td style='display:none;'>"+goodsList[i].goodsSpec+"&nbsp;</td>");


                        $(goodsTrObj).append(controlStr);
                        $("#goodsListBody").append(goodsTrObj);

                    }
                    $("#goodsListBody").append("<tr><td colspan='10' align='center'>"+data.page+"</td></tr>");
                    callback();

                }
        );
    }

    function getShopsListAjax(p,callback){
        var p = arguments[0] ? arguments[0] : 1;
        $.post("{:U('Admin/Package/getShopListAjax')}",
                {
                    shopName:$("#shopName").val(),
                    shopSn:$("#shopSn").val(),
                    areaId1:$("#areaId1").val(),
                    areaId2:$("#areaId2").val()
                },
                function(data){
                    var trStr = '';
                    var shopsList = data.data;
                    $("#shopsListBody").empty();
                    for(var i = 0;i <shopsList.length;i++){
                        var shopTrObj = document.createElement("tr");
                        $(shopTrObj).append("<td style='display: none;'>"+shopsList[i].shopId+"</td>");
                        $(shopTrObj).append(" <td > "+shopsList[i].shopName+" </td>");
                        $(shopTrObj).append(" <td > "+shopsList[i].shopSn+" </td>");
                        $(shopTrObj).append("  <td>"+shopsList[i].userName+"&nbsp;</td>");
                        $(shopTrObj).append("<td>"+shopsList[i].catName+"&nbsp;</td>");
                        $(shopTrObj).append('<td class="text-center"><a class="btn btn-primary glyphicon selectShops" >选择</a></td>');
                        $("#shopsListBody").append(shopTrObj);

                    }
                    $("#shopsListBody").append("<tr><td colspan='10' align='center'>"+data.page+"</td></tr>");
                    if(callback){
                        callback();
                    }


                }
        );
    }

    function del(id){
        Plugins.confirm({title:'信息提示',content:'您确定要删除该商家吗?',okText:'确定',cancelText:'取消',okFun:function(){
            Plugins.closeWindow();
            Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
            $.post("{:U('Admin/Shops/del')}",{id:id},function(data,textStatus){
                var json = WST.toJson(data);
                if(json.status=='1'){
                    Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
                        location.reload();
                    }});
                }else{
                    Plugins.closeWindow();
                    parent.showMsg({msg:'操作失败!',status:'danger'});
                }
            });
        }});
    }
    function getAreaList(objId,parentId,t,id){
        var params = {};
        params.parentId = parentId;
        $('#'+objId).empty();
        if(t<1){
            $('#areaId3').empty();
            $('#areaId3').html('<option value="">请选择</option>');
        }
        var html = [];
        $.post("{:U('Admin/Areas/queryByList')}",params,function(data,textStatus){
            html.push('<option value="">请选择</option>');
            var json = WST.toJson(data);
            if(json.status=='1' && json.list.length>0){
                var opts = null;
                for(var i=0;i<json.list.length;i++){
                    opts = json.list[i];
                    html.push('<option value="'+opts.areaId+'" '+((id==opts.areaId)?'selected':'')+'>'+opts.areaName+'</option>');
                }
            }
            $('#'+objId).html(html.join(''));
        });
    }

    /**
     * 上一步
     */

    $(".last-step").click(function(){

        var currentStep = $(this).parents("[currentStep]").attr("currentStep");
        switch(currentStep){
            case "2":
                $("#selectGoodsBox").addClass("hidden");
                $("#selectShopBox").removeClass("hidden");

                break;
            case "3":
                $("#packagePriceBox").addClass("hidden");
                $("#selectGoodsBox").removeClass("hidden");
                break;

        }
    });

    /**
     * 下一步
     */
    $(".next-step").click(function(){
        var currentStep = $(this).parents("[currentStep]").attr("currentStep");
        switch(currentStep){
            case "1":
                if($.isEmptyObject(shopsSelectedList)){
                   alertModal("未选择任何商家");
                }else{
                    $("#goodsShopName").empty();

                    for(var item in shopsSelectedList){
                        $("#goodsShopName").append("<option value='"+item+"'>"+shopsSelectedList[item]+"</option>");
                    }

                    getGoodsListAjax(1,function(){
                        $("#selectGoodsBox").removeClass("hidden");
                        $("#selectShopBox").addClass("hidden");
                    });


                }
                break;
            case "2":

                if(!$.isEmptyObject(goodsSelectedList)){
                    $("#tGoodsList").empty();
                    var listEm = null;
                    for(var item in goodsSelectedList){
                        listEm  = document.createElement("li");
                        $(listEm).addClass("media");
                        $(listEm).append( "<a class='pull-left' href='#'> <img class='media-object' src='"+goodsSelectedList[item].goodsThums+"'> </a>");
                        var bodyDiv = document.createElement("div");
                        $(bodyDiv).addClass("media-body");
                        $(bodyDiv).append("<h4 class='media-heading'>"+goodsSelectedList[item].goodsName+"</h4>");
                        $(bodyDiv).append("<div class='media-heading'>"+goodsSelectedList[item].goodsSpec+"</div>");
                        $(bodyDiv).append("<div class='media-heading goodsPrice'>"+goodsSelectedList[item].goodsPrice+"</div>");
                        $(bodyDiv).append("<div class='media-heading'>套餐价格：<input type='text' class='tPrice'></div>");


                        $(listEm).append(bodyDiv);
                        $(listEm).attr("goodsId",item);

                        $("#tGoodsList").append(listEm);

                    }
                    $("#packagePriceBox").removeClass("hidden");
                    $("#selectGoodsBox").addClass("hidden");
                }else{
                    alertModal("未选择任何商品");
                   // alert("没有选择任何商品");
                }

                break;
            case "3":
                var flag = true;
                $("#tGoodsList li").each(function(){
                    var goodsId = $(this).attr("goodsId");
                    var goodsPrice = parseFloat($(this).find(".goodsPrice").text());
                   var tPrice = $(this).find("input").val();
                     tPrice = tPrice?(!isNaN(tPrice)?parseFloat(tPrice):0):0;
                    if(tPrice <= 0 || tPrice > goodsPrice){
                        alertModal("套餐价格必须是小于商品价格的正数");
                        flag = false;
                        return false;
                    }else{
                        goodsSelectedList[goodsId]["tPrice"] = tPrice;
                    }

                });

                var tStartTime = $("#tStartTime").val();
                var tEndTime = $("#tEndTime").val();
                    var tName = $("#tName").val();

                if(tStartTime == '' || tEndTime == ''){
                    alertModal("套餐开始或介绍日期不能为空");
                    flag == false;
                }
                if(tName ==''){
                    alertModal("套餐名不能为空");
                }






                if(flag){
                    $.post("{:U('Admin/Package/addPackageData')}",
                            {
                                goodsList:goodsSelectedList,
                                tDesc:$("#tDesc").val(),
                                tStartTime:$("#tStartTime").val(),
                                tEndTime:$("#tEndTime").val(),
                                tName:tName
                            },function(data){
                                alertModal(data.msg);
                            }
                    );
                }
                break;
        }
    });

    $(".chk").change(function(){
        if($(this)[0].checked){
            shopsSelectedList[$(this).val()] = $(this).parent().siblings().eq(1).text();

        }else{
            delete shopsSelectedList[$(this).val()];
        }
        console.log(shopsSelectedList);
    });



    function checkChks (obj,cobj){
        $(cobj).each(function() {
            $(this)[0].checked = obj.checked;
            if ($(this)[0].checked) {
                if (!shopsSelectedList[$(this).val()]) {
                    shopsSelectedList[$(this).val()] = $(this).parent().siblings().eq(1).text();
                }

            } else {
                if (shopsSelectedList[$(this).val()]) {
                    delete shopsSelectedList[$(this).val()];
                }
            }
        });
        console.log(shopsSelectedList);
    }

    /**
     * 商品列表分页
     */
    $("#goodsListBody").on("click",".wst-ajax-pagination a",function(){
        getGoodsListAjax($(this).attr("p"));
    });

    /**
     * 商家列表分页
     */

    $("#shopsListBody").on("click",".wst-ajax-pagination a",function(){
        getShopsListAjax($(this).attr("p"));
    });

    /**
     * 搜索商品按钮
     */
    $("#searchGoodsBtn").click(function(){
        getGoodsListAjax();
    });

    /**
     * 选择商家获取商品类表
     */
    $("#goodsShopName").change(function(){
        getGoodsListAjax();
    });

    /**
     * 选择商品
     */
    $("#goodsListBody").on("click",".selectGoods",function(){
        var goodsPrice  = null;
        if($.isEmptyObject(periodSelected)){
            goodsPrice = parseFloat($(this).parent().siblings().eq(3).text());
            if(isNaN(goodsPrice)){
                alertModal("该商品价格分不同时段，请选择");
                return false;
            }
        }else{
            goodsPrice = periodSelected.periodPrice;
        }
        var goodsId = $(this).parent().siblings().eq(0).text();
        if(!goodsSelectedList[goodsId]){
            var object = new Object();
            var goodsName = $(this).parent().siblings().eq(1).text();
            object.goodsName = goodsName;
            var shopName = $("#goodsShopName").text();
            object.shopName = shopName;

            object.goodsPrice = goodsPrice;
            var thumb = $(this).parent().siblings().eq(1).children("img").attr("src");
            object.goodsThums = thumb;
            var goodsSpec = $(this).parent().siblings().eq(6).text();
            object.goodsSpec = goodsSpec;
            goodsSelectedList[goodsId] = object;

            var spanStr = '<span class="label label-default" goodsId="'+goodsId+'">'+goodsName+'<a style="font-size: xx-small" class="removeGoods text-danger"><span class="glyphicon glyphicon-remove"></span></a></span>';
            $("#goodsSelected").append(spanStr);
            console.log(goodsSelectedList);
        }else{
            alertModal(" 该商品已选择");
        }

    });

    /**
     * 选择商家
     */
    $("#shopsListBody").on("click",".selectShops",function(){
        var shopId = $(this).parent().siblings().eq(0).text();
        if(!shopsSelectedList[shopId]){
            var shopName = $(this).parent().siblings().eq(1).text();

            shopsSelectedList[shopId] = shopName;

            var spanStr = '<span class="label label-default" shopId="'+shopId+'">'+shopName+'<a style="font-size: xx-small" class="removeShops text-danger"><span class="glyphicon glyphicon-remove"></span></a></span>';
            $("#shopsSelected").append(spanStr);
        }else{
            alertModal("该商家已选择");
        }

    });

    /**
     * 删除已选的商品
     */
    $("#goodsSelected").on("click",".removeGoods",function(){
        var goodsId = $(this).parent().attr("goodsId");
        $(this).parents("span").remove();
        delete goodsSelectedList[goodsId];
    });

    /**
     * 养生、娱乐商家商品价格窗口
     */
    var priceTd = null;//临时保存当前的价格td
    $("#goodsListBody").on("click",".selectPeriod",function(){
        var goodsId = $(this).parent().siblings().eq(0).text();
        priceTd = $(this).parent().siblings().eq(3);
        $("#myModal .modal-body").load("{:U('Admin/Package/getPeriodPrice')}",{id:goodsId},function(){
            $('#priceTab').TabPanel({tab:0});
            $("#myModal").modal();
        });

    });


    /**
     * 删除已选择的商家
     */
    $("#shopsSelected").on("click",".removeShops",function(){
        var shopId = $(this).parent().attr("shopId");
        $(this).parents("span").remove();
        delete shopsSelectedList[shopId];
    });


    /**
     * 搜索商家
     */

    $("#searchShopBtn").click(function(){
        getShopsListAjax();
    });


    /**
     * 选择价格
     */
    $("#myModal").on("click",".priceTr",function(){
        if($(this).hasClass("bg-info")){
            $(this).removeClass("bg-info");
            $(this).find(".selectedFlag").addClass("hidden");
//            for(var prop in periodSelected){
//                delete periodSelected[prop];
//            }
        }else{
            $(".priceTr").removeClass("bg-info");
            $(this).addClass("bg-info");
            $(".selectedFlag").addClass("hidden");
            $(this).find(".selectedFlag").removeClass("hidden");

        }

    });

    $("#priceSelect").click(function(){
        var trSelected = $("#myModal .priceTr").filter(".bg-info");
        if(trSelected.length != 0){
            periodSelected.priceId = trSelected.children().eq(0).text();
            periodSelected.periodPrice = trSelected.children().eq(4).text();
            periodSelected.weekDate = trSelected.children().eq(5).text();
            periodSelected.startTime = trSelected.children().eq(1).text();
            periodSelected.endTime = trSelected.children().eq(3).text();
            periodSelected.isTom = trSelected.children().eq(2).text();
            priceTd.empty();
            priceTd.append("<div>"+numberToWeek(parseInt(periodSelected.weekDate))+"</div><div>"+periodSelected.startTime+"-"+periodSelected.endTime+"</div><div>"+periodSelected.periodPrice+"</div>");
        }
        $("#myModal").modal("hide");
    });



    $(function(){



        <notempty name='areaId1'>
        getAreaList("areaId2",'{$areaId1}',0,'{$areaId2}');
        </notempty>

    });
</script>
</html>